function datenow() {
    let now = new Date();
    let year = now.getFullYear();
    let month = now.getMonth();
    let day = now.getDate();
    let hour = now.getHours();
    let minute = now.getMinutes();
    let second = now.getSeconds();
    nowstr = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
    return nowstr;
    // window.document.body.innerText = nowstr;
}
// window.setInterval(test1,1000);

function displays() {
    let post = window.document.getElementById("post1");
    post.style = "display:block";
}
function releases() {
    let post = window.document.getElementById("post1");
    post.style = "display:none";
    // 获取from表单的值,组成新的HTML标签
    // 插入到ul
   let title = post.firstElementChild.value;
   //alert(title);
   let select = post.firstElementChild.nextElementSibling;
   //alert(select.value);
   let textarea = window.document.getElementsByClassName("content")[0];
   //alert(textarea.value);

    let li = window.document.createElement("li");
    let div = window.document.createElement("div")
    let images = window.document.createElement("img");
    let h1 = window.document.createElement("h1");
    let p = window.document.createElement("p");
    let span1 = window.document.createElement("span");
    let span2 = window.document.createElement("span");
    div.appendChild(images);
    p.appendChild(span1);
    p.appendChild(span2);
    li.appendChild(div);
    li.appendChild(h1);
    li.appendChild(p);
    // arrimg = [
    //     {imgurl:require("images/tou01.jpg")},
    //     {imgurl:require("images/tou02.jpg")},
    //     {imgurl:require("images/tou03.jpg")},
    //     {imgurl:require("images/tou04.jpg")}
    // ];
    // for = "(item,index) in arrimg":key = "index";

    images.src = "images/tou02.jpg";//最终图片加入到html里,所以要从HTML的路径找图片!
    h1.innerText = title;
    span1.innerText = "板块" + select.value;
    span2.innerText = "发表时间:" + datenow();

    let ullist = window.document.getElementById("ullist");
    ullist.insertBefore(li,ullist.firstChild);


}